package com.example.hello;

import com.example.hello.client.Brand.BootstrapBrandRpc;
import com.example.hello.client.Brand.BootstrapBrandState;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.ui.AbstractComponent;

public class BootstrapBrand extends AbstractComponent {

    private BootstrapBrandRpc rpc = new BootstrapBrandRpc() {
        public void click(MouseEventDetails details) {
            fireEvent(new BootstrapEvent(BootstrapBrand.this));
        }
    };

    public BootstrapBrand() {
        this("");
    }

    public BootstrapBrand(String text) {
        setBrandEnabled(true);
        setHref("");
        setName("");
        setText(text);
        setTarget("_self");

        registerRpc(rpc);
    }

    @Override
    protected BootstrapBrandState getState() {
        return (BootstrapBrandState) super.getState();
    }

    public boolean isBrandEnabled() {
        return getState().isBrandEnabled();
    }

    public String getHref() {
        return getState().getHref();
    }

    public String getName() {
        return getState().getName();
    }

    public String getTarget() {
        return getState().getTarget();
    }

    public String getText() {
        return getState().getText();
    }

    public void setBrandEnabled(boolean brandEnabled) {
        getState().setBrandEnabled(brandEnabled);
    }

    public void setHref(String href) {
        getState().setHref(href);
    }

    public void setName(String name) {
        getState().setName(name);
    }

    public void setTarget(String target) {
        getState().setTarget(target);
    }

    public void setText(String text) {
        getState().setText(text);
    }

}